package entity.maintenance.dto;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import entity.maintenance.MaintenanceProgram;

public class MaintenanceProgramQueryWrapperDto {
    public QueryWrapper<MaintenanceProgram> conditional(MaintenanceProgram maintenanceProgram){
        QueryWrapper<MaintenanceProgram> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("delete_flag",0);
        if (maintenanceProgram.getProgramCoding()!=null){
            queryWrapper.like("program_coding",maintenanceProgram.getProgramCoding());
        }
        if (maintenanceProgram.getProgramName()!=null){
            queryWrapper.like("program_name",maintenanceProgram.getProgramName());
        }
        if (maintenanceProgram.getMaintenanceSite()!=null){
            queryWrapper.like("Maintenance_site",maintenanceProgram.getMaintenanceSite());
        }
        if (maintenanceProgram.getMaintenanceLevel()!=null){
            queryWrapper.eq("Maintenance_level",maintenanceProgram.getMaintenanceLevel());
        }
        if (maintenanceProgram.getProgramState()!=null){
            queryWrapper.eq("program_state",maintenanceProgram.getProgramState());
        }
        if (maintenanceProgram.getOperator()!=null){
            queryWrapper.like("operator",maintenanceProgram.getOperator());
        }
        if (maintenanceProgram.getUpdateTime()!=null){
            queryWrapper.like("update_time",maintenanceProgram.getUpdateTime());
        }
        return queryWrapper;
    }

}
